1. Field of the Invention
The present invention relates generally to an image processing method and an image processing apparatus using the same, and, more particularly, to a method for acquiring the texture color taking into consideration LOD (Level of Detail) values of object data such as polygon data, as well as to an image processing apparatus using the same.
2. Description of the Related Art
FIG. 1 depicts texture mapping in computer graphics technology. FIG. 1A shows screen space in (sx, sy) coordinate system, in which a texture suitable for the polygon PG performed as an object on the screen is read from texture memory and mapped per pixel. In FIG. 1A, point x of a polygon PG indicates one of the pixels which compose a polygon PG in (sx, sy) coordinate system.
FIG. 1B shows texture space in (u, v) coordinate system of texture memory. There texture appropriate for each pixel is read by accessing the address space in texture memory included in the polygon data. In FIG. 1B, point X is a texel in address space (tu, tv) in texture memory, equivalent to the point x of polygon PG on the screen.
If texture color of the texel which is determined by address space (tu, tv) of texture memory is to be mapped onto the polygon as it is, it would be difficult to get the smooth rendering image when polygon moves in the direction parallel to the screen, as the degree of the texture color variance is large.
Such problems can be avoided by employing bilinear filtering, a well-known technique to obtain the appropriate texture color values to be written on polygons. (cf. JP-7-40171)
FIG. 2 depicts the bilinear filtering. In FIG. 2, texels a to f in texture memory are shown. In the case that polygons move parallel to the screen, texture address of the pixel corresponding to texel b switches to that of texel e. But the simple transition from texel b to texel e causes nonsmooth image rendering, as color variance is too large.
Thus, in bilinear filtering, weighted averaging is needed for a pixel and adjacent four texels, i.e., weighted averaging is to be made in domain II of the 1×1 texel which includes the centered pixel PC and adjacent texels b, c, e, and f. The calculation result should be the color value of the texture to be obtained.
FIG. 3 depicts the relation between the distance from the viewpoint (VP) and the rendering image of polygons. As is indicated in FIG. 3A., such a case should be studied when polygons move vertically against the VP.
The farther the polygon moves from the VP along the z axis, the smaller the size of performed polygon becomes as is shown in FIG. 3B and FIG. 3C, and the rougher the LOD (Level of Detail) value of the rendering image.
For this reason, texture MIP mapping structure, as shown in FIG. 4 is employed. Multiple texture MIP maps of different sizes, which are 2n times as large each other, are to be prepared beforehand. The MIP map which best matches the polygon is selected according to the distance from VP, namely, the LOD level.
When polygons move along z axis, however, it is difficult to get the smooth image rendering by simply switching the MIP maps, as the color variance is too large at the points of transition.
To avoid such inconveniences, trilinear filtering technique, as is described in JP-7-40171 mentioned above is used. As shown in FIG. 3A, when a polygon moves along z axis, from pointα through domainβ to pointγ, MIP map, MP1 in FIG. 4 is used at pointα, and MIP map, MP2 is used at point γ. As it can be seen in FIG. 3A, the degree of the texture color variance is significantly large at the transition points from α to γ, if these two MIP maps are used.
Thus, the domainβ is to be put in-between, and the texture color, whose value is calculated from those of the texture colors of MP1 and MP2 is to be interpolated.
Texture color values for MP1 and MP2 are obtained from that of bilinearly filtered texture color, explained in FIG. 2.
As described above, bilinear filtering and trilinear filtering techniques are known as smoothening technique of image rendering.
The LOD value of the texture to be mapped onto polygon PG becomes larger in proportion to the Z value of the pixel. As is explained in FIG. 3, texture is to be given as MIP map structure to avoid the large color variance, aliasing, at the time of texture mapping to polygon. In this case, texture MIP map corresponding to the LOD value of the polygon should be referred to.
With bilinear filtering technique, a discontinuity in the texture will remain at the point of the transition of texture MIP maps chosen according to the LOD values. Trilinear filtering technique is used to avoid this defect. Here, a color value to be interpolated is calculated from two texture color values of the neighboring texture MIP maps bilinearly filtered according to the LOD values.
The discontinuity in the texture can be adjusted by adopting the calculation result (interpolation) as the ultimate texture color.
There is a problem in terms of the image and performance, however, when you adopt trilinear filtering mentioned above.
Trilinear filtering is so composed as to generate the texture color from two texture maps each of which has different LOD; thus unnecessary color information at low frequency will be added. The image after filtering becomes blurred by this.
Two random accesses should inevitably occur with the trilinear filtering technique, in which MIP map structure is loaded in the memory and texels are referred to from two different MIP maps. Thus, theoretically speaking, performance will be ½ compared to the case using bilinear filtering technique. The real efficiency is worse than that; below ½.
As is shown in FIG. 2, the size of the domain in which weighted averaging is implemented for a pixel and adjacent texels remains the same in bilinear filtering.
Thus, as shown in FIG. 5, if polygon PG to which texture is to be mapped is skewed against the screen SC, i.e., if polygon is skewed in the depth direction from VP (z axis), there will occur the problem mentioned below.
In such cases, as the size of the domain remains the same when using bilinear and trilinear filtering technique, the additional unnecessary color information of the texel may be added. The texture image will be blurred after the filtering procedure.